﻿using System;
using System.Collections.Generic;
using Expemerent.UI.Dom;

namespace Expemerent.UI.Behaviors
{
    /// <summary>
    /// Defines event phase
    /// </summary>
    public enum Phase
    {
        /// <summary>
        /// bubbling (emersion) phase
        /// </summary>
        Bubbling = 0,

        /// <summary>
        /// capture (immersion) phase, this flag is or'ed with EVENTS codes below
        /// </summary>
        Sinking = 0x08000,

        /// <summary>
        /// event already processed.
        /// </summary>
        Handled = 0x10000,

        /// <summary>
        /// Syntetic value 
        /// </summary>
        All = Bubbling | Sinking | Handled
    }

    /// <summary>
    /// Defines a base class for all input events. Input events can be generated by user or be a synthetic
    /// </summary>
    [Serializable]
    public class InputEventArgs : ElementEventArgs
    {
        /// <summary>
        /// Creates a new instance of the <see cref="InputEventArgs"/> class
        /// </summary>
        public InputEventArgs(Element element, Phase phase)
            : base(element)
        {
            Phase = phase;
        }

        /// <summary>
        /// Event phase
        /// </summary>
        public Phase Phase { get; protected internal set; }

        /// <summary>
        /// Target element
        /// </summary>
        public Element Target { get; internal set; }
    }
}
